﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace _6_5
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (textUserName.Text == "mr" && textPwd.Text == "mrsoft")
            {
                Session["UserName"] = textUserName.Text;//使用Session变量记录用户名
                Session["TimeLogin"] = DateTime.Now;//使用Session变量记录用户登录系统的时间
                Response.Redirect("~/UserPage.aspx");//跳转到主页
            }
            else
            {
                Response.Write("<script>alert('登录失败！请返回查找原因');location='Login.aspx'</script>");
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            textUserName.Text = textPwd.Text = "";
        }

        protected void TextBox1_Click(object sender, EventArgs e)
        {

        }

        protected void TextBox2_Click(object sender, EventArgs e)
        {

        }
    }
}